<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="csrf-token" content="{{csrf_token()}}">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
</head>
{:do_action('admin_head')}
<body>
  <div class="layui-fluid">
    <div class="layui-card">
      <form onclick="return false;" class="info_tj">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
          <div class="layui-form-item">

            <div class="layui-inline">
              <label class="layui-form-label">键</label>
              <div class="layui-input-block">
                <input type="text" name="key" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
            </div>
             <div class="layui-inline">
              <label class="layui-form-label">值</label>
              <div class="layui-input-block">
                <input type="text" name="value" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">类别</label>
              <div class="layui-input-inline">
                <select name="type">
                    <option value="user">用户</option>
                    <option value="system">系统</option>
                    <option value="addons">插件</option>
                </select>
                  
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">备注</label>
              <div class="layui-input-block">
                <input type="text" name="msg" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
            </div>

            
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm" onclick="tijiao_data('/admin/config/custom_config',0)"  >新增</button>
            </div>
          </div>
        </div>
      </form>
      <div class="layui-card-body">
        <table class="layui-table">
            <colgroup>
              <col width="30">
              <col>
            </colgroup>
            <thead>
              <tr>
                <th>ID</th>
                <th>键</th>
                <th>值</th>
                <th>类别</th>
                <th>备注</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <?php foreach($list as $k=>$vo){ ?>
                <tr>
                  <td>{$vo['id']}</td>
                  <td>{$vo['key']}</td>
                  <td>{$vo['value']|mb_substr=0,15,'utf-8'}</td>
                  <td>{$vo['type']}</td>
                  <td>{$vo['msg']}</td>
                  <td>
                    <button class="layui-btn layui-btn-xs" onclick="zfAdminShow('编辑','custom_config_edit?id={$vo['id']}')">编辑</button>

                    <?php  if($vo['type']!='system'){ ?>     
                      <!-- <button class="layui-btn layui-btn-xs" onclick="zfAdminShow('编辑','custom_config_edit?id={$vo['id']}')">编辑</button> -->
                    <?php } ?>
                  </td>
                </tr>
              <?php } ?>
            </tbody>
          </table>
      </div>
    </div>
  </div>

  {:widget_st('jq','js')}
  {:widget_st('layui','js')}  
  {:widget_st('common','js')}
  <script>
 layui.use([ 'table','element'], function(){
    var $ = layui.$
    ,form = layui.form
    ,element = layui.element
    ,table = layui.table;

    form.on('switch(status_change)', function(data){
      var id = $(this).attr("item")
      var dbname = "config"
      var status = this.checked ? '1' : '0'
      console.log(id)
      $.get("{:url('admin/common/is_switch')}",{id:id,dbname:dbname,status:status},function(res){
          if(res.result==1){
            layer.msg(res.msg, {icon: 1});
          }else{
            layer.msg(res.msg, {icon: 2});
          }
        },"json");
    });

  });
  </script>
</body>
</html>
{:do_action('admin_js')}
